<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<%@ include file="/commons/validation.jsp"%>
<%@ include file="/commons/dateTime.jsp" %>
<%@ include file="/commons/fileUpload.jsp" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>出入证新增</title>
<script type="text/javascript" src="${ctx }/scripts/public3.js"></script>
<script type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script type="text/javascript">

	var ACTION_URL = "${ctx}/renovation_certificateAction.do?";

	function setMsg(response){
		$('passNumber').validateMessage = response.responseText;
	}

	function saveWin(){ //保存

		var isTrue=$("passAddEditForm").fireEvent("onSubmit");
		if (!isTrue){
			return ;
		}

  		var url ="";

  		var keyword = $('keyword').value;
		if(keyword == ""){
			url =ACTION_URL+"method=addPass";
		}else{
			url = ACTION_URL+"method=editPass";
		}

		$('passAddEditForm').target="";
		$('passAddEditForm').action = url;
  		$('passAddEditForm').submit();
  	}

	function saveAndAdd(){ //保存并新增

		var isTrue=$("passAddEditForm").fireEvent("onSubmit");
		if (!isTrue){
			return ;
		}

  		var url ="";
		var keyword = $('keyword').value;

		if(keyword == ""){
			url =ACTION_URL+"method=addPass&flush=true";
		}else{
			url = ACTION_URL+"method=editPass&flush=true";
		}

		$('passAddEditForm').action = url
  		//$('mySubmit').click();
  		$('passAddEditForm').submit();
	}

	function setButtonStatus(status){ //设置按钮状态 true 代表可用 false代表不可用
		$("btn1_42").disabled = !status;
		$("btn1_22").disabled = !status;
		$("btn1_32").disabled = !status;
	}

</script>

</head>

<body>
<iframe  id="showReslt" name="showReslt" style="display:none" ></iframe>
<form id="passAddEditForm" name="passAddEditForm" method="post" action="" target="showReslt" class="required-validate" ENCTYPE="multipart/form-data">
 	<input id="mySubmit"  type="submit" style="display:none">
	<input name="renovateLicenceId" id="renovateLicenceId" type="hidden" value="${licenceId}">
	<input name="keyword" id="keyword" type="hidden" value="${passVO.keyword}">

	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	  <tr>
	    <td class="window_head_outBg">
	    <table border="0" cellpadding="0" cellspacing="0">
		      <tr>
		        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle" /> <span class="window_head_intext">出入证申请</span></td>
		      </tr>
	    </table>
	    </td>
	  </tr>
	  <tr><td class="aux_header_line_1"></td></tr>
	  <tr><td class="aux_header_line_2"></td></tr>
	  <tr>
	    <td class="content">

		<table width="100%" border="0" cellspacing="0" cellpadding="0">
	      <tr>
	        <td class="aux_outtable_color"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
	            <tr>
	              <td class="aux_intable_td1">出入证号：</td>
	              <td class="aux_intable_td2">
	              	<input name="passNumber" id="passNumber" type="hidden"  value="${passVO.passNumber}"  size="16" />${passVO.passNumber }</td>
	              </tr>
	            <tr>
	              <td class="aux_intable_td1">姓 名：</td>
	              <td class="aux_intable_td2"><input name="name" id="name" type="text" class="inputtext validate-char max-length-36" value="${passVO.name}" size="16" /></td>
	              </tr>
	            <tr>
	              <td class="aux_intable_td1">性 别：</td>
	              <td class="aux_intable_td2">
	              	<input name="sex"  type="radio" value="1"  <c:if test="${passVO.sex == '1'}">checked="checked"</c:if> >男&nbsp;&nbsp;&nbsp;&nbsp;
	              	<input name="sex"  type="radio" value="0" <c:if test="${passVO.sex == '0'}">checked="checked"</c:if> >女
	              </td>
	              </tr>
				<tr>
	              <td class="aux_intable_td1">工 种：</td>
	              <td class="aux_intable_td2">
	                <pms:unitedSelect
	               		id="workType"
	               		name="workType"
	               		optionLabel="name"
	               		optionValue="value"
	               		selectText="请选择..."
	               		dataList="${workTypeList}"
	               		value="${passVO.workType }"
	               		style="width:90px;">
		         	</pms:unitedSelect>
	              </td>
	              </tr>
				<tr>
				  <td class="aux_intable_td1">身份证号码：</td>
				  <td class="aux_intable_td2"><input name="identityCard" id="identityCard" type="text" class="inputtext  validate-char max-length-36" value="${passVO.identityCard}" size="16" /></td>
				  </tr>
				<tr>
				  <td class="aux_intable_td1">相 片：</td>
				  <td class="aux_intable_td2">
	               	<mypms:ImageUpload name="photoImage"
									   postfixName="empPhoto"
									   data="${passVO.photoVo}"
									   imageType="jpg,gif"
									   maxSize="500">
	  				</mypms:ImageUpload>

	               </td>
				  </tr>
				  <tr>
	              <td class="aux_intable_td1">有效期：</td>
	              <td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
	                <tr>
	                  <td><input name="beginDate" id="beginDate" type="text" class="inputtext required validate-date" value="<fmt:formatDate pattern='yyyy-MM-dd' value='${passVO.beginDate}'/>"  size="8" afterInsert="beginDateSpan"/></td>
	                  <td width="4">&nbsp;</td>
	                  <td width="4"><img id="imgBeginDate" name="imgBeginDate" src="${ctx}/images/ico_clock_month.gif" width="20" height="20" /><div id="beginDateSpan"></div> </td>
	                  <td >&nbsp;至&nbsp;</td>
	                  <td><input name="endDate" id="endDate" type="text" class="inputtext required validate-date great-equals-than-beginDate"  value="<fmt:formatDate pattern='yyyy-MM-dd' value='${passVO.endDate}'/>"  size="8" afterInsert="endDateSpan"/></td>
	                  <td width="4">&nbsp;</td>
	                  <td><img id="imgEndDate" name="imgEndDate" src="${ctx}/images/ico_clock_month.gif" width="20" height="20" /><span id="endDateSpan"></span> </td>

	                </tr>
	              </table></td>
	              </tr>
	          </table>
	        </td>
	      </tr>
	    </table>

		</td>
	  </tr>
	  <tr>
	    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
	      <tr>
		    <td>
		     <c:if test="${passVO.keyword == null}">
		    <table border="0" cellpadding="0" cellspacing="0">
	          <tr>
	            <td class="buttonOffLeft" id="btn1_41"></td>
	            <td class="buttonOffMiddle" id="btn1_42" onClick="saveAndAdd();" onMouseOver="btn_change_over(4)" onMouseOut="btn_change_out(4)" onblur="btn_change(4)"><img src="${ctx}/images/ico_saveandnewfile.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 保存并新增</td>
	            <td class="buttonOffRight" id="btn1_43"></td>
	          </tr>
	        </table>
	        </c:if>
	        </td>
	        <td class="btn_between_space">&nbsp;</td>
	        <td><table border="0" cellpadding="0" cellspacing="0">
	            <tr>
	              <td class="buttonOffLeft" id="btn1_21"></td>
	              <td class="buttonOffMiddle" id="btn1_22" onClick="saveWin();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onBlur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 保 存</td>
	              <td class="buttonOffRight" id="btn1_23"></td>
	            </tr>
	        </table></td>
	        <td class="btn_between_space"></td>
	        <td><table border="0" cellpadding="0" cellspacing="0">
	            <tr>
	              <td class="buttonOffLeft" id="btn1_31"></td>
	              <td class="buttonOffMiddle" id="btn1_32" onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onBlur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 关 闭</td>
	              <td class="buttonOffRight" id="btn1_33"></td>
	            </tr>
	        </table></td>
	      </tr>
	    </table></td>
	  </tr>
	</table>
</form>

<script type="text/javascript">

              Calendar.setup(
              {
	              inputField : "beginDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "imgBeginDate", // ID of the button
	             // align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

              Calendar.setup(
              {
	              inputField : "endDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "imgEndDate", // ID of the button
	             // align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );

</script>

</body>
</html>